/**
 * 
 */
package com.yhty.web.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.yhty.model.House;
import com.yhty.service.HouseManager;

/**
 * 房屋action
 * @author roy
 */
@Controller
@RequestMapping("/house")
public class HouseAction {
	
	private HouseManager houseManager;

	/**
	 * 添加房屋
	 * @param house
	 * @param model
	 */
	@RequestMapping(value="/add")
	public void add(){
		
	}
	
	/**
	 * 保存房屋信息
	 * @param house
	 * @param model
	 */
	@RequestMapping(value="/save",method = RequestMethod.POST)
	public String save(House house,Model model){
		this.houseManager.addHouse(house);
		return "save:list";
	}
	
	/**
	 * 获取房屋列表
	 * @return
	 */
	@RequestMapping(method = RequestMethod.GET)
	public String list(Model model){
		model.addAttribute("list", this.houseManager.getAll()); 
		return "list";
	}

	@Autowired
	public void setHouseManager(HouseManager houseManager) {
		this.houseManager = houseManager;
	}
}
